import json
import model

# test_texts = {
#    'instruction': "你是一个文本分类领域的专家，你会接收到一段文本和几个潜在的分类选项，请输出文本内容的正确类型",
#    'input': "文本:查询任务编号：TASK212400000501的排产任务表,类型选型:['任务编码', '工作站','订单编号']"
#    }

# 读取span标签配置
with open("category/label_config.json", "r") as fileSpan:
    data = json.load(fileSpan)
    categorys = [item['text'] for item in data]
    print(categorys)

ttt = "查询任务编号：TASK212400000501的排产任务表"
test_texts = {
    "instruction": "你是一个文本分类领域的专家，你会接收到一段文本和几个潜在的分类选项，请输出文本内容的正确类型",
    'input': "文本:" + ttt + ",类型选型:" + json.dumps(categorys, ensure_ascii=False)
}

instruction = test_texts['instruction']
input_value = test_texts['input']

messages = [
    {"role": "system", "content": f"{instruction}"},
    {"role": "user", "content": f"{input_value}"}
]

response = model.predict(messages, model.load_tokenizer_model(), model.load_model())
print(response)
